package xio.ccf_201312;

import java.util.Scanner;

/**
 * 201312-2 ISBN号码 100分
 * Created by xio on 2017/11/14.
 */

public class ISBN {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String isbnStr = sc.nextLine();
        char[] isbnChars = isbnStr.toCharArray();

        //  前9位数字 按规则求和
        int sum = 0;
        int index = 1;

        for (int i = 0; i <= 11; i++) {
            char c = isbnChars[i];
            if (c == '-') {
                continue;
            }
            int num = Integer.parseInt(c + "");
            sum += num * index;
            index++;
        }


        //根据求和结果算出最后一位识别码
        int code = sum % 11;

        if (code == 10) {
            isbnChars[isbnChars.length - 1] = 'X';
        } else {
            isbnChars[isbnChars.length - 1] = (code + "").charAt(0);
        }

        //将我们算得的正确isbn码和原输入的待检测isbn字符串做比较
        String correctISBN = String.copyValueOf(isbnChars);
        if (correctISBN.equals(isbnStr)) {
            System.out.println("Right");
        } else {
            System.out.println(correctISBN);
        }

    }
}
